package com.sprites;

import com.bricks2break.Statics;
import com.events.DoubleBallSpeedEvent;

import android.graphics.Paint;

public class DoubleBallSpeedBrick extends AbstractSpecialBrick {
	/**
	 * Double ball speed brick class constructor
	 * 
	 * @param paint
	 * @param value
	 * @param durationTime
	 */
	public DoubleBallSpeedBrick(Paint paint, int value, float durationTime) {
		super(paint, value, durationTime);
	}

	/**
	 * Draw method
	 */
	public void draw(android.graphics.Canvas canvas) {
		// Call super.draw to draw brick
		super.draw(canvas);
		// Draw text on top of brick
		canvas.drawText("2x speed", getX() - getWidth() / 2 + 10, getY(), Statics.black);
	}

	@Override
	/**
	 * Method that adds a double speeds event to EventTimer, so the ball gets double speed in a given duration
	 */
	public void addEvent(Object subject) {
		if (subject instanceof Ball) {
			System.out.println(getDurationTime());
			Statics.eventTimer.addEvent(new DoubleBallSpeedEvent(getDurationTime(), (Ball) subject));
		}
	}

}
